Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Add middleware for debug headers #497

Merged
merged 3 commits into from
Sep 9, 2020
Merged

Add middleware for debug headers #497

merged 3 commits into from
Sep 9, 2020

Conversation

sethvargo
Copy link
Member

If the request sends an x-debug header with any value, the response headers will be populated with the build ID and tag.

Release Note

Return build information in response headers if `X-Debug` is supplied as a request header

/cc @icco

@googlebot googlebot added the cla: yes Auto: added by CLA bot when all committers have signed a CLA. label Sep 9, 2020
// ProcessDebug adds additional debugging information to the response if the
// request included the "X-Debug" header with any value.
func ProcessDebug(ctx context.Context) mux.MiddlewareFunc {
header := "x-debug"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: seems like this should be a const

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also - I'm not sure x-debug is the right header, maybe something like x-build-info ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made them constants. The return headers are x-buildinfo-*. This is the request header, and I'd like to give us flex to add other debug information if we wanted to in the future.

If the request sends an x-debug header with any value, the response headers will be populated with the build ID and tag.
@sethvargo
Copy link
Member Author

@mikehelmick PTAnotherL

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mikehelmick, sethvargo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mikehelmick,sethvargo]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot google-oss-robot merged commit d8c2cb1 into main Sep 9, 2020
@google-oss-robot google-oss-robot deleted the sethvargo/debug branch September 9, 2020 17:29
@google google locked and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Auto: added by CLA bot when all committers have signed a CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants